
$(function () {

    $('#men').selected({
        maxHeight: '400px'
    });


    $('#table5').bootstrapTable({
        url: '${pageContext.request.contextPath}/../../jiaofeidan/list',
        columns: [
            {
                field: 'id',
                title: 'id',
                visible : false,
            },{
                field: 'orderid',
                title: '单号'
            }, {
                field: 'house.sale.name',
                title: '楼盘',
                visible : false,
            }, {
                field: 'house.danyuan.name',
                title: '单元',
                visible : false,
            }, {
                field: 'house.floor',
                title: '楼成',
                visible : false,
            }, {
                field: 'house.doornumber',
                title: '门牌号',
                formatter: function (value, row, index) {
                    return "百家小区 "+row.house.sale.name+" "+row.house.danyuan.name+"  "+row.house.floor+"楼  门牌号："+row.house.doornumber;
                }
            },{
                field: 'date',
                title: '建档日期',

            },{
                field: 'money',
                title: '费用',
                // visible : false,
            },{
                field: 'remark',
                title: '备注',
            }],
        contentType:"application/x-www-form-urlencoded",
        queryParamsType: '',
        //修改分页的默认对数
        //offset,limit
        height: 700,
        pageNumber: 1,
        pageSize: 15,
        pagination:true,
        queryParams: queryParams,
        sidePagination:'server',
        detailView:true,
        onExpandRow:function(index, row, $detail){
            console.log("123123")
            var aa=$detail.html("<table></table>").find('table');
            aa.bootstrapTable({
                url: '${pageContext.request.contextPath}/../../jfxq/quanbujianyi?name='+row.id,
                columns: [{
                    field: 'id',
                    title: 'id',
                    visible : false,
                },{
                    field: 'lasttime',
                    title: '上次读数'
                },{
                    field: 'sdate',
                    title: '上次日期'
                },{
                    field: 'costitem.name',
                    title: '计费名称'
                },{
                    field: 'costitem.money',
                    title: '计费单价'
                },{
                    field:'number',
                    title:'用量',
                },{
                    field:'zmoney',
                    title:'费用金额',
                }],
            }) ;
        }


    });
})
function queryParams(params) {

    var temp = {  //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
        'pageSize': params.pageSize,  //页面大小
        'pageNumber': params.pageNumber, //页码
        'name':$("#men").val(),
    };
    return temp;
};

function search() {
    var opt = $("#table5").bootstrapTable('getOptions');
    var men = $("#men").val();
    var ss=(opt.pageSize)
    $.post('${pageContext.request.contextPath}/../../jiaofeidan/list', {
        'name':men,
        'pageSize': opt.pageSize,
        'pageNumber': 1
    }, function (data) {
        //重新给table绑定数据
        $("#table5").bootstrapTable("load", data);
    });
}